@extends('layouts.admin')
@section('content')
    <!--面包屑导航 开始-->
    <div class="crumb_warp">
        <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
        <i class="fa fa-home"></i> <a href="{{ url('admin/info') }}">首页</a> &raquo; 导航栏列表
    </div>
    <!--面包屑导航 结束-->

    <!--搜索结果页面 列表 开始-->
    <form action="#" method="post">
        <div class="result_wrap">
            <!--快捷导航 开始-->
            <div class="result_content">
                <div class="result_title">
                    <h3>导航栏管理操作</h3>
                </div>
                <div class="short_wrap">
                    <a href="{{url('admin/navs/create')}}"><i class="fa fa-plus"></i>添加导航栏</a>
                    <a href="{{url('admin/navs')}}"><i class="fa fa-recycle"></i>导航栏列表</a>
                </div>
            </div>
            <!--快捷导航 结束-->
        </div>

        <div class="result_wrap">
            <div class="result_content">
                <table class="list_tab">
                    <tr>
                        <th class="tc">排序</th>
                        <th class="tc">ID</th>
                        <th>名称</th>
                        <th>别名</th>
                        <th>地址</th>
                        <th>操作</th>
                    </tr>

                    @foreach($data as $v)
                    <tr>
                        <td class="tc">
                            <input type="text" onchange="changeOrder(this, {{ $v->nav_id }});" name="ord[]" value="{{ $v->nav_order }}">
                        </td>
                        <td class="tc">{{ $v->nav_id }}</td>
                        <td>
                            <a href="#">{{ $v->nav_name }}</a>
                        </td>
                        <td>{{ $v->nav_alias }}</td>
                        <td>{{ $v->nav_url }}</td>
                        <td>
                            <a href="{{ url('admin/navs/'. $v->nav_id . '/edit') }}">修改</a>
                            <a href="javascript:;" onclick="del_nav('{{ $v->nav_id }}')">删除</a>
                        </td>
                    </tr>
                    @endforeach

                </table>

                {{--<div class="page_nav">--}}
                    {{--<div>--}}
                        {{--<a class="first" href="/wysls/index.php/Admin/Tag/index/p/1.html">第一页</a>--}}
                        {{--<a class="prev" href="/wysls/index.php/Admin/Tag/index/p/7.html">上一页</a>--}}
                        {{--<a class="num" href="/wysls/index.php/Admin/Tag/index/p/6.html">6</a>--}}
                        {{--<a class="num" href="/wysls/index.php/Admin/Tag/index/p/7.html">7</a>--}}
                        {{--<span class="current">8</span>--}}
                        {{--<a class="num" href="/wysls/index.php/Admin/Tag/index/p/9.html">9</a>--}}
                        {{--<a class="num" href="/wysls/index.php/Admin/Tag/index/p/10.html">10</a>--}}
                        {{--<a class="next" href="/wysls/index.php/Admin/Tag/index/p/9.html">下一页</a>--}}
                        {{--<a class="end" href="/wysls/index.php/Admin/Tag/index/p/11.html">最后一页</a>--}}
                        {{--<span class="rows">11 条记录</span>--}}
                    {{--</div>--}}
                {{--</div>--}}

            </div>
        </div>
    </form>
    <!--搜索结果页面 列表 结束-->
    <script>
        function changeOrder(obj, nav_id) {
            var nav_order = $(obj).val();
            $.post('{{url('admin/change_order')}}',{'_token':'{{csrf_token()}}','id':nav_id,'order':nav_order,'type':'navs'}, function (data) {
                layer.msg(data.msg);
            })
        }

        function del_nav(nav_id) {
            //询问框
            layer.confirm('您确定要删除这个导航栏吗？', {
                btn: ['确定','取消'] //按钮
            }, function(){
                //发送post请求
                $.post('{{url('admin/navs/')}}/' + nav_id, {_method:'DELETE','_token':'{{csrf_token()}}'}, function (data) {
                    if(data.errno) {
                        layer.msg(data.msg, {icon: 2});
                    }else {
                        layer.msg('删除成功', {icon: 1});
                        location.href=location.href;
                    }
                })
            }, function(){
                //layer.msg('11', {icon: 2});
            });
        }
    </script>

@endsection